//
//  CommitDiffCell.swift
//  GitOSC-Swift
//
//  Created by 李萍 on 16/3/11.
//  Copyright © 2016年 李萍. All rights reserved.
//

import UIKit
import Kingfisher

class CommitDiffCell: UITableViewCell {
    @IBOutlet weak var userPortrait: UIImageView!
    @IBOutlet weak var userNameLabel: UILabel!
    @IBOutlet weak var timeLabel: UILabel!
    @IBOutlet weak var contentLabel: UILabel!

    override func awakeFromNib() {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool) {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }
    
    func setContentForCommitDiff(commit: GTCommit) {
        let url:NSURL = NSURL(string: "https://git.oschina.net/"+(commit.author?.portrait)!)!
        self.userPortrait.kf_setImageWithURL(url, placeholderImage:UIImage.init(named: "portrait_loading"))
        self.userNameLabel.text = commit.authorName
        self.timeLabel.text = commit.createdAt.substringToIndex(commit.createdAt.startIndex.advancedBy(10))
        self.contentLabel.text = commit.title
    }
    
}
